package org.liveboardgames.agricola.control.delegates.mock.cards.actioncards
{
    import org.liveboardgames.agricola.control.delegates.mock.ActionFactory;
    import org.liveboardgames.agricola.model.enums.ActionOutputEnum;
    import org.liveboardgames.agricola.model.enums.ResourceZoneEnum;
    import org.liveboardgames.agricola.view.component.ImageHandler;
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.agricola.vo.card.ActionCard;
    
    import mx.collections.ArrayCollection;
    import mx.collections.ListCollectionView;
    
    [Bindable]
    public class FourPlayersFamilyCards
    {
        public static const TWO_CLAY:ActionCard = getTwoClayCard();
        
        public static const TWO_WOOD:ActionCard = getTwoWoodCard();
        
        public static const ONE_WOOD:ActionCard = getOneWoodCard();
        
        public static const REED_STONE_FOOD:ActionCard = getReedStoneFoodCard();
        
        public static const TRAVELING_PLAYER:ActionCard = getTravelingPlayerCard();
        
        public static const TWO_BUID_MATERIAL:ActionCard = getTwoBuildMatCard();
        
        private static function getTravelingPlayerCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Traveling player";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "TravelingPlayer.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            var foodAction:Action = ActionFactory.getResourceAction(ActionOutputEnum.FOOD, 1, true);
            foodAction.target = card;
            foodAction.needPlayerInput = false;
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(foodAction);
            actions.addItem(takeAction);
            
            card.actions = actions;
            
            return card;
        }
        
        private static function getReedStoneFoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One Reed, One Stone, One Food";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "ReedStoneFood.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            var reed:Action = ActionFactory.getResourceAction(ActionOutputEnum.REED, 1, false);
            reed.needPlayerInput = false;
            var stone:Action = ActionFactory.getResourceAction(ActionOutputEnum.STONE, 1, false);
            stone.needPlayerInput = false;
            var food:Action = ActionFactory.getResourceAction(ActionOutputEnum.FOOD, 1, false);
            food.needPlayerInput = false;
            
            actions.addItem(reed);
            actions.addItem(stone);
            actions.addItem(food);
            
            card.actions = actions;
            
            return card;
        }
        
        private static function getTwoClayCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Two clay";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "TwoClay.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            // Accumulation of resources
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CLAY, 2, true);
            action.target = card;
            action.needPlayerInput = false;
            
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(action);
            actions.addItem(takeAction);
            card.actions = actions;
            
            return card;
        }
        
        private static function getTwoWoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Two woods";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "TwoWood.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            // Accumulation of resources
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.WOOD, 2, true);
            action.target = card;
            action.needPlayerInput = false;
            
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            
            return card;
        }
        
        private static function getOneWoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One wood";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "OneWood.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            // Accumulation of resources
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.WOOD, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            
            return card;
        }
        
        private static function getTwoBuildMatCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Two building materials";
            card.imagePath = ImageHandler.FOUR_PLAYERS_FAMILY + "TwoBuildingMaterial.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CHOICE_RESOURCE, 2);
            actions.addItem(action);
            card.actions = actions;
            
            return card;
        }
    }

}